package info.motteke.mixivoice4j.http;

import java.io.IOException;
import org.apache.http.HttpResponse;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.ResponseHandler;
import org.apache.http.util.EntityUtils;


public class StringResponseHandler implements ResponseHandler<String> {

    private final String charset;

    public StringResponseHandler(String charset){
        this.charset = charset;
    }

    @Override
    public String handleResponse(HttpResponse res) throws ClientProtocolException, IOException {
        return EntityUtils.toString(res.getEntity(), charset);
    }
}
